-
Notifications
You must be signed in to change notification settings - Fork 46
Add support for character device GPIO #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nastevens (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Alternative to #29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
@rust-embedded/embedded-linux folks do you have any opinions on this approach?
bors try
tryBuild failed |
The changes generally look Ok, I had some extra concerns at first related to semver but 0.3 is not published yet so that should be OK. Probably the main thing to consider changing here would be to do the additional conditional compilation to allow for completely dropping the sysfs gpio dep if the feature is not selected. I question the choice to expose |
yeah this is a good point, would renaming to
seems reasonable to me, i guess this would look like adding a tangentially (and outside the scope of this PR), is there a point at which we want to switch people from one to the other? and, is there some way we could do this automagically at runtime instead of requiring people to compile specifically for the gpio mode? (not that support for older kernels doesn't always require a GLIBC dance anyway) |
I think regardless we will not be backwards compatible, right unless someone changes the features around. Since we having a semver move to 0.3 I think it probably makes sense to introduce the breakage and avoid trying to do the rename. The names you propose look reasonable to me. Doing things this way also would allow enabling both features if desired (this could make sense for some people as people may want to use cdev for some new stuff but might still rely on udev rules to setup symlinks which would be used with sysfs).
I think we just put the deprecation front and center and focus development on the newer stuff. The fact of the matter is that there are a lot of engineers who may want to use rust but will be continuing to work against systems that do not have cdev even after sysfs_gpio is deprecated in upstream kernels. Thinking specifically of 3.10 based systems. These products should move to 4.9 LTSI but that's easier said than done depending on the SoC vendor and drivers in use. Right now I think we focus on making sure that people can use cdev and over push them that way; the hammer can come a bit later. |
IMO that make sense since we can break the backward comapibility. So I'll prepare commit that introduces SysfsPin and CdevPin enabled with different features. Does it work for you?
|
Sounds good to me. |
The SysfsPin export can be enabled with feature flag "gpio_sysfs".
The CdevPin export can be enabled with feature flag "gpio_cdev".
0e90b03
to
6809164
Compare
README.md
Outdated
Since Linux kernel v4.4 the use of sysfs GPIO was deprecated and replaced by the character device GPIO. | ||
See [gpio-cdev documentation](https://github.com/rust-embedded/gpio-cdev#sysfs-gpio-vs-gpio-character-device) for details. | ||
|
||
This crate includes feature flag `gpio_cdev` that exposes `CdevPin` as wrapper around `LineHandle` from [gpio-cdev](https://crates.io/crates/gpio-cdev). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could also have a note on dropping linehandles here and in the rustdocs for the CdevPin?
(relates to: rust-embedded/gpio-cdev#29)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also if you could also add the notes to the changelog that'd be excellent, otherwise one of us can do it before releasing.
(thanks again for all your work / sorry for the back and forth!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, I was happy to help, thanks. Is there anything else I could do for the project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in review. The updates look great to me. Thanks for your patience and contribution!
bors r+
Build succeeded |
No description provided.